﻿@model S4Store.Models.Decorate.PackageCarSaleModel
@{
    Layout = null;
    ViewBag.Title = "PackageCarSale";

    S4Store.Models.Chart.Column ChartModel = new S4Store.Models.Chart.Column();
    ChartModel.Name = "各车型套餐车销售状况KPI";
    ChartModel.YAxis = "数量(台)";
    foreach (var m in Model.Reports)
    {
        ChartModel.XAxis.Add(m.CarBrand.Name);
    }
    S4Store.Models.Chart.ChartSeries series1 = new S4Store.Models.Chart.ChartSeries();
    series1.Name = "本月交车数";
    foreach (var m in Model.Reports)
    {
        series1.Data.Add(m.GiveCarCount);
    }
    ChartModel.Serieses.Add(series1);

    S4Store.Models.Chart.ChartSeries series2 = new S4Store.Models.Chart.ChartSeries();
    series2.Name = "套餐车销售数";
    foreach (var m in Model.Reports)
    {
        series2.Data.Add(m.PackageCount);
    }
    ChartModel.Serieses.Add(series2);


    ChartModel.IsRate = false;


    List<S4Store.Models.Chart.RedGreenIndex> RedGreenIndexs = new List<S4Store.Models.Chart.RedGreenIndex>();
    foreach (var m in Model.Reports)
    {
        S4Store.Models.Chart.RedGreenIndex index = new S4Store.Models.Chart.RedGreenIndex();
        index.Size = S4Store.Models.Chart.RedGreenIndex.IndexSize.Middle;
        index.Value = m.PackageDiff.toInt()+"%";
        if (m.PackageDiff >= 0)
        {
            index.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Green;
        }else{
            index.Type = S4Store.Models.Chart.RedGreenIndex.IndexType.Red;
        }
        index.Url = Url.Action("PackageCarSaleDetail", new { SearchCarBrandId = m.CarBrand.Id });
        index.Tip = m.CarBrand.Name + "套餐车销售状况KPI";
        index.Title = "当月套餐车实际销售率与套餐车目标销售率的差值";
        RedGreenIndexs.Add(index);
    }
}
<div style="height:100%; overflow:auto">
@Html.Action("ReportBar", "Common", Model.BarModel)
<div style="position:relative; width:100%">
      
        @Html.Partial("../Chart/Column", ChartModel)
        @Html.Partial("../Chart/RedGreenIndex", RedGreenIndexs)
    
</div>
</div>